//package cn.com.zetatech.loader.resolver.service.impl;
//
//import cn.com.zetatech.loader.entity.FileResolveLog;
//import cn.com.zetatech.loader.entity.ParquetMessage;
//import cn.com.zetatech.loader.mapper.ResolverMapper;
//import cn.com.zetatech.loader.resolver.service.ResolverParquetFunction;
//import cn.hutool.core.date.DateUtil;
//import cn.hutool.core.util.IdUtil;
//import cn.hutool.core.util.ObjectUtil;
//import com.google.gson.Gson;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.stereotype.Service;
//
//import java.io.IOException;
//import java.nio.file.Files;
//import java.nio.file.Path;
//import java.nio.file.Paths;
//
///**
// * @author jian.chen@zetatech.com.cn
// * @Description TODO
// * @Date 2024/8/18 22:15
// */
//@Slf4j
//@Service
//@Qualifier("resolveDemoServiceImpl")
//public class ResolveDemoServiceImpl extends ResolverParquetFunction {
//
//    @Autowired
//    private Gson gson;
//
//    @Autowired
//    private ResolverMapper resolverMapper;
//
//    @Override
//    public void handle(ParquetMessage message) throws Exception {
//        System.out.println("start1111 " + message.getJobId());
//        FileResolveLog fileResolveLog = new FileResolveLog();
//        fileResolveLog.setMsg(gson.toJson(message));
//        this.save(fileResolveLog);
//
//    }
//
//    @Override
//    public void save(FileResolveLog fileResolveLog) throws Exception {
//        fileResolveLog.setId(IdUtil.objectId());
//        fileResolveLog.setFilePath("filePath");
//        fileResolveLog.setFileName("fileName");
//        fileResolveLog.setFileSize(8);
//        fileResolveLog.setCreateTime(DateUtil.now());
//        fileResolveLog.setBackupTime(DateUtil.now());
//        resolverMapper.insert(fileResolveLog);
//        log.info("log {}", fileResolveLog.toString());
//    }
//
//    @Override
//    public FileResolveLog check(FileResolveLog fileResolveLog) throws Exception {
//        return null;
//    }
//
//
//
//    public static void createDirectoryForFileIfNotExists(String nasFilePath) {
//        Path filePath = Paths.get(nasFilePath);
//        Path directoryPath = filePath.getParent(); // 获取文件所在的目录路径
//
//        if (directoryPath != null && !Files.exists(directoryPath)) {
//            try {
//                Files.createDirectories(directoryPath);
//                System.out.println("Directory created at: " + directoryPath);
//            } catch (IOException e) {
//                System.err.println("Failed to create directory: " + e.getMessage());
//            }
//        }
//    }
//
//    public static void main(String[] args) {
//        String nasFilePath = "C:\\Users\\86130\\Downloads\\test\\output22.csv";  // 替换为实际的NAS文件路径
//        createDirectoryForFileIfNotExists(nasFilePath);
//    }
//}